home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1984 Half 1
/
rerun-1984-01-06-side-a.d64
/
fnctkey feb p70
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
132 lines
0 rem function keys
1 rem commodore 64 version
2 rem
3 rem by john tanzini
4 rem and ron mindzak
5 rem
6 rem
7 rem**
8 rem*** variable list
9 rem**
10 rem t = actual top of memory
15 rem l = total length of all strings defined for function keys
20 rem sm = start of machine language program
25 rem ss = start of strings defined for function keys
30 rem pp = pointer to string pointers
35 rem sp = pointer to strings during loading of strings
40 rem c = counter to determine if byte read from data statement is a checksum
45 rem su = sum used to determine checksum
50 rem ch = checksum read from data statement
55 rem b = byte read from data statement
96 rem
97 rem**
98 rem*** calculate top of memory and reserve memory for strings
99 rem**
100 t = peek(55) + 256*peek(56)
110 poke 56, peek(46)+2
120 poke 52, peek(56)
130 print "[147]function keys":print
196 rem
197 rem**
198 rem*** define strings and print them out
199 rem**
200 dim f$(12)
210 f$(1) = "list "
220 f$(2) = "load"+chr$(34)
230 f$(3) = "run"
240 f$(4) = "save"+chr$(34)+"@:"
250 f$(5) = "print peek( )[157][157][157][157][157][157]"
260 f$(6) = "open 15,8,15,"+chr$(34)
270 f$(7) = "print fre(0)"
280 f$(8) = "close 15"
290 f$(9) = "goto "
300 f$(10) = "gosub "
310 f$(11) = "return"
320 f$(12) = "poke "
330 for i = 1 to 12
340 print "f" + right$(str$(i),len(str$(i))-1) + " = ";
345 print chr$(34) + f$(i) + chr$(34)
350 next i
396 rem
397 rem**
398 rem*** determine starting locations for strings and machine language program
399 rem**
400 l = 0
410 for i = 1 to 12
420 l = l + len(f$(i))
430 next i
435 if l > 231 then print "strings too long": goto 800
440 sm = t - 132
450 ss = t - l - 156
496 rem
497 rem**
498 rem*** store strings and pointers
499 rem**
500 pp = ss: sp = ss + 12
510 for i = 1 to 7 step 2: gosub 1000: next i
520 for i = 2 to 8 step 2: gosub 1000: next i
530 for i = 9 to 12: gosub 1000: next i
596 rem
597 rem**
598 rem*** load machine language program
599 rem**
600 for i = sm to sm+131
610 read b
611 su = su + b
612 c = c + 1
613 if c<>19 and i<>(sm+131) then 620
614 read ch
615 if ch = su then c=0: su=0: goto 620
616 print: print "data statement error"
617 print "in line"; peek(63) + 256*peek(64)
618 goto 800
620 poke i, b
630 next i
696 rem
697 rem**
698 rem*** setup for machine language program
699 rem**
700 poke 250, sm/256
710 poke 249, sm-256*peek(250)
715 poke 248, 76
720 poke 252, ss/256
730 poke 251, ss-256*peek(252)
740 poke 649, 9
750 poke 55, peek(251): poke 56, peek(252)
760 poke 51, peek(251): poke 52, peek(252)
761 poke t-13, peek(789)
762 poke t-14, peek(788)
770 sys 248
780 new
796 rem
797 rem**
798 rem*** restore the actual top of memory if an error occors
799 rem**
800 poke 56, t/256
810 poke 55, t - 256*peek(56)
820 end
996 rem
997 rem**
998 rem*** subroutine to store strings for f$(i)
999 rem**
1000 poke pp, sp-ss: pp = pp+1
1005 if f$(i) = "" then 1060
1010 for j = 1 to len(f$(i))
1030 poke sp, asc(mid$(f$(i),j,1))
1040 sp = sp+1
1050 next j
1060 poke sp, 0
1070 sp = sp + 1
1080 return
8996 rem
8997 rem**
8998 rem*** data for machine language program
8999 rem**
9000 data120,165,250,141,21,3,165,249,24,105,21,144,3,238,21,3,141,20,3,1837
9010 data88,96,165,198,208,92,165,254,240,91,169,0,133,254,164,253,24,144,56,2794
9020 data201,6,240,17,202,201,5,240,12,202,201,4,240,7,169,255,141,128,2,2473
9030 data48,58,134,253,162,0,173,141,2,201,1,208,2,162,4,201,2,208,2,1962
9040 data162,8,138,24,101,253,205,128,2,240,30,141,128,2,168,177,251,168,162,2488
9050 data0,177,251,240,17,157,119,2,200,232,134,198,224,9,208,241,132,253,169,2963
9060 data1,133,254,76,49,234,162,3,165,197,201,3,240,187,202,24,144,162,2437